From: Jonas Ã…dahl Date: Wed, 17 Nov 2021 10:14:00 +0000 (+0100) Subject: x11: Trap error when getting CRTC info X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~91^2^2~121^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b9bdbe9aaecf0aa0726637b8c5466c6e2ff7bfd6;p=gtk4.git x11: Trap error when getting CRTC info This should fix a race happening when RANDR changes quickly, e.g. during unit testing where tests change monitor configurations rapidly. --- diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index e84645bf17..bde0b7dd54 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -492,9 +492,18 @@ init_randr15 (GdkX11Screen *x11_screen) if (output_info->crtc) { - XRRCrtcInfo *crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc); + XRRCrtcInfo *crtc; int j; + gdk_x11_display_error_trap_push (display); + crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, + output_info->crtc); + if (gdk_x11_display_error_trap_pop (display)) + { + XRRFreeOutputInfo (output_info); + continue; + } + for (j = 0; j < resources->nmode; j++) { XRRModeInfo *xmode = &resources->modes[j];